<?php

namespace App\Api\Validate;

use Illuminate\Support\Facades\Validator;

class ReviewValidate extends BaseValidate
{

    public function add($params)
    {
        $rules = [
            'review'            => 'required',
            'images'            => 'array',
            'service_rating'    => 'required|integer|between:1,5',
            'health_rating'     => 'required|integer|between:1,5',
            'facilities_rating' => 'required|integer|between:1,5',
            'network_rating'    => 'required|integer|between:1,5',
        ];

        $messages = [
            'review.required'           => '评价不能为空~',
            'images.array'              => '图片格式不支持',
            'service_rating.between'    => '服务评分必须在1到5之间。',
            'health_rating.between'     => '健康评分必须在1到5之间。',
            'facilities_rating.between' => '设施评分必须在1到5之间。',
            'network_rating.between'    => '网络评分必须在1到5之间。',
        ];
        $validator = Validator::make($params, $rules, $messages);

        $this->check($validator);
    }
}
